package com;

import com.mapper.StudentMapper;
import com.mapper.SubjectMapper;
import com.pojo.Subject;
import com.pojo.Student;
import com.utils.MyBatisUtils;
import org.junit.Test;

/**
 * @author YDW
 * projectName:project2202_3
 * time:2022/4/28 15:57
 * description:
 */
public class testm2m {
    @Test
    public void findsubjectById(){
        SubjectMapper mapper = MyBatisUtils.getMapper(SubjectMapper.class);
        Subject subject = mapper.findById(102);
        System.out.println(subject);
        System.out.println(subject.getStudents());
    }
    @Test
    public void findstudentById(){
        StudentMapper mapper = MyBatisUtils.getMapper(StudentMapper.class);
        Student student = mapper.findById(2);
        System.out.println(student);
        System.out.println(student.getSubjects());
    }
}
